package model

import (
	"ginblog/tools/pagination"
	"ginblog/utils/errmsg"
)

type CustomPage struct {
	BaseModel
	PageName string `gorm:"type:varchar(20);not null;comment:'自定义页面'" json:"page_name"`
	Content  string `gorm:"type:text(256);not null;comment:'自定义内容'" json:"content"`
	PageIcon string `gorm:"type:varchar(256);not null;comment:'自定义页面缩略图'" json:"page_icon"`
}

func (c *CustomPage) GetAllCustom(page *pagination.Pagination) {
	var custom_list []CustomPage
	err := Db.Limit(page.GetPageSize()).Offset(page.GetOffset()).Find(&custom_list).Error
	if err != nil {
		c.SteCodeMsg(errmsg.ERROR)
	}
	page.SetTotalPage()
	page.Data = custom_list

}
